import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';

import { BaseEntity } from './BaseEntity';
import { SysUser } from './SysUser';

@Entity()
export class SysSetting extends BaseEntity {
  @Column({
    type: 'boolean',
    name: 'dark_mode',
    default: false,
    comment: '是否暗黑主题'
  })
  darkMode: boolean;

  @Column({
    type: 'varchar',
    default: 'default',
    comment: '主题色名称'
  })
  name: string;

  @Column({
    type: 'varchar',
    default: '#409EFF',
    comment: '主题色'
  })
  color: string;

  @Column({
    type: 'varchar',
    default: 'vertical',
    comment: '布局模式'
  })
  layout: string;

  @Column({
    type: 'boolean',
    default: false,
    comment: '灰色模式'
  })
  grey: boolean;

  @Column({
    type: 'boolean',
    default: false,
    comment: '弱色模式'
  })
  weak: boolean;

  @Column({
    type: 'boolean',
    default: false,
    name: 'hide_tabs',
    comment: '是否隐藏tabs'
  })
  hideTabs: boolean;

  @Column({
    type: 'boolean',
    default: false,
    name: 'hide_footer',
    comment: '是否隐藏footer'
  })
  hideFooter: boolean;

  @Column({
    type: 'boolean',
    default: true,
    name: 'show_logo',
    comment: '是否显示logo'
  })
  showLogo: boolean;

  @Column({
    type: 'varchar',
    default: 'card',
    name: 'show_model',
    comment: 'tab 展示模式'
  })
  showModel: string;

  @ManyToOne(() => SysUser, {
    onDelete: 'CASCADE',
    nullable: true
  })
  @JoinColumn({
    name: 'user_id'
  })
  user: SysUser;
}
